<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>用户数据</title>
    <link rel="stylesheet" type="text/css" href="/zhaojun/layui/css/layui.css"/>
</head>
<body>
<div class="layui-btn-group" style="padding: 20px">
    <button class="layui-btn layui-btn-sm" id="search">
        <i class="layui-icon">&#xe615;</i>查询
    </button>
</div>
<div class="layui-card">
    <table id="user" lay-data="{height: 'full-200'" }></table>
</div>
</body>
<script src="/zhaojun/layui/layui.js" type="text/javascript" charset="utf-8"></script>
<script>
    layui.use(['layer', 'table', 'form'], function () {
        var table = layui.table;
        var $ = layui.$;
        var form = layui.form;

        form.render();

        table.render({
            elem: '#user'
            , id: 'userTable'
            , url: 'http://127.0.0.1:8031/zhaojun-service-im/userData'
            , method: 'post'
            , page: true //开启分页
            , cellMinWidth: 80 //全局定义常规单元格的最小宽度，layui 2.2.1 新增
            , cols: [
                [
                {type: 'checkbox'}
                , {type: 'numbers'}
                , {field: 'account', title: '账号'}
                , {field: 'nid', title: '连接ID'}
                , {field: 'channel', title: '终端'}
                , {field: 'deviceId', title: '设备编号'}
                , {field: 'deviceModel', title: '终端型号'}
                , {field: 'clientVersion', title: '应用版本'}
                , {field: 'systemVersion', title: '系统版本'}
                , {field: 'bindTime', title: '在线时长(秒)'}
                , {field: 'location', title: '位置'}
            ]
            ]
        });

        var active = {
            reload: function () {
                //执行重载
                table.reload('userTable', {
                    method: 'post'
                    , page: {
                        curr: 1 //重新从第 1 页开始
                    }
                });
            }
        };

        $('#search').on('click', function () {
            active.reload();
        });

    });

</script>
</html>